// 主状态管理入口
import { defineStore } from 'pinia'

export const useMainStore = defineStore('main', {
    state: () => ({
        loading: false,
        error: null,
        successMessage: null
    }),

    actions: {
        setLoading(loading) {
            this.loading = loading
        },

        setError(error) {
            this.error = error
        },

        setSuccessMessage(message) {
            this.successMessage = message
        },

        clearMessages() {
            this.error = null
            this.successMessage = null
        }
    }
})
